package com.superhero.common.repository;

import com.superhero.common.pojo.entity.AuthUser;
import com.superhero.common.utils.OptionalUtil;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.Optional;


@Repository
public interface AuthUserRepository extends JpaRepository<AuthUser, Integer>, JpaSpecificationExecutor<AuthUser> {

    /**
     * @param username
     * @return
     */
    Optional<AuthUser> findAuthUserByUsername(String username);

    /**
     * @param openId
     * @return
     */
    Optional<AuthUser> findAuthUserByWxOpenId(String openId);

    /**
     * @param id
     * @return
     */
    OptionalUtil<AuthUser> findAuthUserById(Integer id);

}
